#ifndef __p_cicrlechamfer__
#define __p_cicrlechamfer__
if(token.Matches(_("p_circlechamfer"))&&(T.GetCount()==6))
{
    IsNotExtFunc = false;
    uint CH = int(calc(T[0]));
    uint IM = int(calc(T[1]));

    //*********************************//
    double R = calc(T[2]);          //SAFETY ALTITUDE
    double A = calc(T[3]);          //SAFETY ALTITUDE
    double Z = calc(T[4]);
    double S = calc(T[5]);          //STEP in ROUND

    //************************************//
    //IMAGE SHOULD ONLY CONTAIN ONE CIRCLE//
    if(!C[CH].Size()==1){ERR << wxString::Format(_("ERR:: Circle chamfer wrong number elements\n"));break;}
    if(!C[CH].T(0)>1){ERR << wxString::Format(_("ERR:: NOT Circle\n"));break;}
    if(I[IM].ME.size()==0){ ERR << _("ERR:: Circle chamfer no chamfer Z image found"); break;}

    //************************************//
    double DIA = C[CH].P1(0).x - C[CH].PC(0).x;
    double OFF = GetToolOffset(  A ,&SIM.T[tNum],&I[IM]);


    uint G;
    if( C[CH].T(0)==173)
    {
        G=3;
    }
    else
    {
        G=2;
    }



    CODE << wxString::Format(wxT("G1X%5.3fY%5.3f\n"), DIA-OFF   + C[CH].PC(0).x, C[CH].PC(0).y  );
    //CODE << wxString::Format(wxT("G0X%5.3fY%5.3f\n"), DIA-OFF , C[CH].PC(0).y  );
    CODE << wxString::Format(wxT("G0Z0.\n") );

    S/=2;
    double z=A;

    while(true)
    {
        OFF = GetToolOffset(  z ,&SIM.T[tNum],&I[IM]);
        z-=S;
        double OFF2 = GetToolOffset( z     ,&SIM.T[tNum],&I[IM]);
        CODE << wxString::Format(wxT("G%dX%5.3fZ%5.3fI%5.3f\n"),G, -DIA + OFF2 + C[CH].PC(0).x , z ,-((DIA*2)-OFF-OFF2) /2 );


        if(z<Z)
        {
            CODE << wxString::Format(wxT("G0Z%5.3f.\n"),R);
            break;
        }

        //************************************************//
        OFF = GetToolOffset(  z ,&SIM.T[tNum],&I[IM]);
        z-=S;
        OFF2 = GetToolOffset( z     ,&SIM.T[tNum],&I[IM]);
        CODE << wxString::Format(wxT("G%dX%5.3fZ%5.4fI%5.3f\n"),G, DIA-OFF2 +C[CH].PC(0).x  ,z,  ((DIA*2)-OFF - OFF2) /2 );

        if(z<Z)
        {
            CODE << wxString::Format(wxT("G0Z%5.3f.\n"),R);
            break;
        }
    }
    continue;
}
#else
INFO << _("p_circlechamfer(c,i,r,a,z,Ae)<BR>");

if(token.Matches(_("p_circlechamfer(*")))
{
    INFO = _("<b>p_circlechamfer</b>(c,i,r,a,z,Ap)<BR>");
    INFO << _("(circlechamfer)<BR>");
    INFO << _("c = base line chain<BR>");
    INFO << _("i = Z image chamfer<BR>");
    INFO << _("r = end altitude<BR>");
    INFO << _("a = surface<BR>");
    INFO << _("z = total depth<BR>");
    INFO << _("Ae= cut depth<BR><BR>");
    INFO << _("print to g<BR>");
    INFO << _("<BR>");
    return true;
}
#endif
